PolizaAsesor = function(){
	return {
		generate: function(){
			Asg.Window.openWindow("reportes/polizasPorAsesor", Ext.getCmp("asgSeguroForm").getForm().getValues());
		},
		initConfig: function(config){
			return {
				items: {
					xtype: "form",
					id: "asgSeguroForm",
					margins: "5 5 5 5",
					border: false,
					height: 170,
					buttons: [
				          {
				        	  xtype: "button",
				        	  text: "Generar Reporte",
				        	  iconCls: Asg.constants.XLS_ICON,
				        	  minWidth: 125,
				        	  handler: PolizaAsesor.generate
				          },{
				        	  text: "Borrar Filtros",
				        	  iconCls: Asg.constants.CANCEL_ICON,
				        	  minWidth: 125,
				        	  handler: function(){
	        	        		   Ext.getCmp("asgSeguroForm").getForm().reset();
	        	        	  }
	    	        	 }
		            ],
					items: {
						xtype: "fieldset",
						title: "PARAMETROS DE BUSQUEDA",
						style: "background: #FFFFFF;",
						layout: {
        	        		type: "table",
							columns: 2,
							tableAttrs: {
					            style: {width: "480px"},
					            align: "center"
							}
        	        	},
        	        	defaults: Asg.Form.defaults({width: 230, labelAlign: "top"}),
        	        	items: [
    	        	        {
	        	        		xtype: "combo",
	        	        		fieldLabel: "Aseguradoras",
	        	        		name: "asgSeguroForm.ctgAseguradoraId",
	        	        		store: new Ext.data.SimpleStore({
	        	        			data: config.ctgAseguradoras || [],
	        	        			fields: ["id", "value"]
	        	        		}),
	        	        		displayField: "value",
	        	        		valueField: "id",
	        	        		listeners: {
	        	        			change: function(){
	        	        				var currentValue = this.getValue();
	        	        				if(!Ext.isEmpty(currentValue)){
	        	        					var data = Asg.Combo.filter(currentValue, config.ctgAsesores, 2);
	        	        					Asg.Combo.loadData("ctgAsesorId", data, false);
	        	        				}else if(Ext.isEmpty(this.getValue())){
	        	        					Asg.Combo.removeAll("ctgAsesorId", false);
	        	        				}
	        	        			}
	        	        		}
        	        		},{
	        	        		xtype: "combo",
	        	        		fieldLabel: "Asesores",
	        	        		id:"ctgAsesorId",
	        	        		name: "asgPoliza.ctgAsesor.ctgAsesorId",
	        	        		store: new Ext.data.SimpleStore({
	        	        			data: [],
	        	        			fields: ["id", "value"]
	        	        		}),
	        	        		displayField: "value",
	        	        		valueField: "id"
        	        		},{
    	        	        	xtype: "datefield",
    	        	        	name: "asgSeguroForm.asgFechaInicio1",
    	        	        	submitFormat: "Ymd",
    	        	        	fieldLabel: "Fecha de Venta",
    	        	        	value: config.asgFechaInicio1
    	        	        },{
    	        	        	xtype: "datefield",
    	        	        	name: "asgSeguroForm.asgFechaInicio2",
    	        	        	submitFormat: "Ymd",
    	        	        	fieldLabel: " ",
    	        	        	labelSeparator: "&nbsp;",
    	        	        	value: config.asgFechaInicio2
    	        	        }
	        	        ]
					}
				}
			};
		}
	};
}();